<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>File - Documentation</title>

    <script src="/static/js/jquery.min.js"></script>
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>

    <!-- Enable responsive viewport -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="/static/css/normalize.css" rel="stylesheet">
    <link href="/static/css/main.css" rel="stylesheet">

    <!-- Custom styles -->
    <link href="/static/css/page.css?body=1" rel="stylesheet" type="text/css" media="all">
    <link href="/static/css/github.css" rel="stylesheet" type="text/css" media="all">
    <link href="/static/css/perfect-scrollbar.min.css" rel="stylesheet">
    <link href="/static/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">

    <link type="text/css" rel="stylesheet" href="styles/ionicons.min.css">
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/static/js/html5shiv.js"></script>
    <script src="/static/js/respond.min.js"></script>
    <![endif]-->

    <script src="/static/js/scrollspy.js"></script>
</head>
<body>
<link rel="import" href="/widget/header.html?__inline">
<div id="main" class="fix-sidebar">
    <div class="sidebar scrollbar ps-container jsdoc-nav">
      <h3>Namespaces</h3><ul><li><a href="fis.html">fis</a><ul class='methods'><li data-type='method'><a href="fis.html#.emit">emit</a></li><li data-type='method'><a href="fis.html#.on">on</a></li><li data-type='method'><a href="fis.html#.once">once</a></li><li data-type='method'><a href="fis.html#.plugin">plugin</a></li><li data-type='method'><a href="fis.html#.release">release</a></li><li data-type='method'><a href="fis.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="fis.html#.removeListener">removeListener</a></li><li data-type='method'><a href="fis.html#.require">require</a></li><li data-type='method'><a href="fis.html#.time">time</a></li></ul></li><li><a href="fis.cache.html">cache</a><ul class='methods'><li data-type='method'><a href="fis.cache.html#.clean">clean</a></li></ul></li><li><a href="fis.cli.html">cli</a><ul class='methods'><li data-type='method'><a href="fis.cli.html#.help">help</a></li><li data-type='method'><a href="fis.cli.html#.run">run</a></li><li data-type='method'><a href="fis.cli.html#.version">version</a></li></ul></li><li><a href="fis.compile.html">compile</a><ul class='methods'><li data-type='method'><a href="fis.compile.html#.analyseComment">analyseComment</a></li><li data-type='method'><a href="fis.compile.html#.clean">clean</a></li><li data-type='method'><a href="fis.compile.html#.extCss">extCss</a></li><li data-type='method'><a href="fis.compile.html#.extHtml">extHtml</a></li><li data-type='method'><a href="fis.compile.html#.extJs">extJs</a></li><li data-type='method'><a href="fis.compile.html#.isInline">isInline</a></li><li data-type='method'><a href="fis.compile.html#.partial">partial</a></li><li data-type='method'><a href="fis.compile.html#.process">process</a></li><li data-type='method'><a href="fis.compile.html#.setup">setup</a></li><li data-type='method'><a href="fis.compile.html#.xLang">xLang</a></li><li data-type='method'><a href="fis.compile.html#~builtinStandard">builtinStandard</a></li><li data-type='method'><a href="fis.compile.html#~pipe">pipe</a></li><li data-type='method'><a href="fis.compile.html#~postStandard">postStandard</a></li></ul></li><li><a href="fis.compile.lang.html">lang</a><ul class='methods'><li data-type='method'><a href="fis.compile.lang.html#.add">add</a></li></ul></li><li><a href="fis.config.html">config</a></li><li><a href="fis.emitter.html">emitter</a></li><li><a href="fis.file.html">file</a></li><li><a href="fis.log.html">log</a><ul class='methods'><li data-type='method'><a href="fis.log.html#.debug">debug</a></li><li data-type='method'><a href="fis.log.html#.error">error</a></li><li data-type='method'><a href="fis.log.html#.format">format</a></li><li data-type='method'><a href="fis.log.html#.info">info</a></li><li data-type='method'><a href="fis.log.html#.notice">notice</a></li><li data-type='method'><a href="fis.log.html#.now">now</a></li><li data-type='method'><a href="fis.log.html#.warn">warn</a></li><li data-type='method'><a href="fis.log.html#.warning">warning</a></li><li data-type='method'><a href="fis.log.html#~log">log</a></li></ul></li><li><a href="fis.project.html">project</a><ul class='methods'><li data-type='method'><a href="fis.project.html#.currentMedia">currentMedia</a></li><li data-type='method'><a href="fis.project.html#.getCachePath">getCachePath</a></li><li data-type='method'><a href="fis.project.html#.getProjectPath">getProjectPath</a></li><li data-type='method'><a href="fis.project.html#.getSource">getSource</a></li><li data-type='method'><a href="fis.project.html#.getTempPath">getTempPath</a></li><li data-type='method'><a href="fis.project.html#.lookup">lookup</a></li><li data-type='method'><a href="fis.project.html#.setProjectRoot">setProjectRoot</a></li><li data-type='method'><a href="fis.project.html#.setTempRoot">setTempRoot</a></li></ul></li><li><a href="fis.uri.html">uri</a></li><li><a href="fis.util.html">util</a><ul class='methods'><li data-type='method'><a href="fis.util.html#.applyMatches">applyMatches</a></li><li data-type='method'><a href="fis.util.html#.base64">base64</a></li><li data-type='method'><a href="fis.util.html#.camelcase">camelcase</a></li><li data-type='method'><a href="fis.util.html#.clone">clone</a></li><li data-type='method'><a href="fis.util.html#.copy">copy</a></li><li data-type='method'><a href="fis.util.html#.del">del</a></li><li data-type='method'><a href="fis.util.html#.download">download</a></li><li data-type='method'><a href="fis.util.html#.escapeReg">escapeReg</a></li><li data-type='method'><a href="fis.util.html#.escapeShellArg">escapeShellArg</a></li><li data-type='method'><a href="fis.util.html#.escapeShellCmd">escapeShellCmd</a></li><li data-type='method'><a href="fis.util.html#.exist">exist</a></li><li data-type='method'><a href="fis.util.html#.ext">ext</a></li><li data-type='method'><a href="fis.util.html#.filter">filter</a></li><li data-type='method'><a href="fis.util.html#.find">find</a></li><li data-type='method'><a href="fis.util.html#.getMimeType">getMimeType</a></li><li data-type='method'><a href="fis.util.html#.glob">glob</a></li><li data-type='method'><a href="fis.util.html#.install">install</a></li><li data-type='method'><a href="fis.util.html#.isAbsolute">isAbsolute</a></li><li data-type='method'><a href="fis.util.html#.isDir">isDir</a></li><li data-type='method'><a href="fis.util.html#.isEmpty">isEmpty</a></li><li data-type='method'><a href="fis.util.html#.isFile">isFile</a></li><li data-type='method'><a href="fis.util.html#.isImageFile">isImageFile</a></li><li data-type='method'><a href="fis.util.html#.isTextFile">isTextFile</a></li><li data-type='method'><a href="fis.util.html#.isUtf8">isUtf8</a></li><li data-type='method'><a href="fis.util.html#.isWin">isWin</a></li><li data-type='method'><a href="fis.util.html#.map">map</a></li><li data-type='method'><a href="fis.util.html#.md5">md5</a></li><li data-type='method'><a href="fis.util.html#.merge">merge</a></li><li data-type='method'><a href="fis.util.html#.mkdir">mkdir</a></li><li data-type='method'><a href="fis.util.html#.mtime">mtime</a></li><li data-type='method'><a href="fis.util.html#.nohup">nohup</a></li><li data-type='method'><a href="fis.util.html#.pad">pad</a></li><li data-type='method'><a href="fis.util.html#.parseUrl">parseUrl</a></li><li data-type='method'><a href="fis.util.html#.pathinfo">pathinfo</a></li><li data-type='method'><a href="fis.util.html#.pipe">pipe</a></li><li data-type='method'><a href="fis.util.html#.query">query</a></li><li data-type='method'><a href="fis.util.html#.read">read</a></li><li data-type='method'><a href="fis.util.html#.readBuffer">readBuffer</a></li><li data-type='method'><a href="fis.util.html#.readJson">readJson</a></li><li data-type='method'><a href="fis.util.html#.realpath">realpath</a></li><li data-type='method'><a href="fis.util.html#.realpathSafe">realpathSafe</a></li><li data-type='method'><a href="fis.util.html#.stringQuote">stringQuote</a></li><li data-type='method'><a href="fis.util.html#.toEncoding">toEncoding</a></li><li data-type='method'><a href="fis.util.html#.touch">touch</a></li><li data-type='method'><a href="fis.util.html#.upload">upload</a></li><li data-type='method'><a href="fis.util.html#.write">write</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="fis.cache-Cache.html">Cache</a><ul class='methods'><li data-type='method'><a href="fis.cache-Cache.html#addDeps">addDeps</a></li><li data-type='method'><a href="fis.cache-Cache.html#mergeDeps">mergeDeps</a></li><li data-type='method'><a href="fis.cache-Cache.html#removeDeps">removeDeps</a></li><li data-type='method'><a href="fis.cache-Cache.html#revert">revert</a></li><li data-type='method'><a href="fis.cache-Cache.html#save">save</a></li></ul></li><li><a href="fis.config.Config.html">Config</a><ul class='methods'><li data-type='method'><a href="fis.config.Config.html#del">del</a></li><li data-type='method'><a href="fis.config.Config.html#get">get</a></li><li data-type='method'><a href="fis.config.Config.html#getMatches">getMatches</a></li><li data-type='method'><a href="fis.config.Config.html#getSortedMatches">getSortedMatches</a></li><li data-type='method'><a href="fis.config.Config.html#hook">hook</a></li><li data-type='method'><a href="fis.config.Config.html#match">match</a></li><li data-type='method'><a href="fis.config.Config.html#media">media</a></li><li data-type='method'><a href="fis.config.Config.html#merge">merge</a></li><li data-type='method'><a href="fis.config.Config.html#set">set</a></li><li data-type='method'><a href="fis.config.Config.html#unhook">unhook</a></li></ul></li><li><a href="fis.file-File.html">File</a><ul class='methods'><li data-type='method'><a href="fis.file-File.html#addAsyncRequire">addAsyncRequire</a></li><li data-type='method'><a href="fis.file-File.html#addLink">addLink</a></li><li data-type='method'><a href="fis.file-File.html#addRequire">addRequire</a></li><li data-type='method'><a href="fis.file-File.html#addSameNameRequire">addSameNameRequire</a></li><li data-type='method'><a href="fis.file-File.html#defineLikes">defineLikes</a></li><li data-type='method'><a href="fis.file-File.html#exists">exists</a></li><li data-type='method'><a href="fis.file-File.html#getBase64">getBase64</a></li><li data-type='method'><a href="fis.file-File.html#getCacheData">getCacheData</a></li><li data-type='method'><a href="fis.file-File.html#getContent">getContent</a></li><li data-type='method'><a href="fis.file-File.html#getHash">getHash</a></li><li data-type='method'><a href="fis.file-File.html#getHashRelease">getHashRelease</a></li><li data-type='method'><a href="fis.file-File.html#getId">getId</a></li><li data-type='method'><a href="fis.file-File.html#getUrl">getUrl</a></li><li data-type='method'><a href="fis.file-File.html#isDir">isDir</a></li><li data-type='method'><a href="fis.file-File.html#isFile">isFile</a></li><li data-type='method'><a href="fis.file-File.html#isImage">isImage</a></li><li data-type='method'><a href="fis.file-File.html#isText">isText</a></li><li data-type='method'><a href="fis.file-File.html#removeAsyncRequire">removeAsyncRequire</a></li><li data-type='method'><a href="fis.file-File.html#removeRequire">removeRequire</a></li><li data-type='method'><a href="fis.file-File.html#revertFromCacheData">revertFromCacheData</a></li><li data-type='method'><a href="fis.file-File.html#setContent">setContent</a></li><li data-type='method'><a href="fis.file-File.html#toString">toString</a></li></ul></li></ul><h3>Events</h3><ul><li><a href="fis.html#.event:lookup:file">lookup:file</a></li></ul>
    </div>

    <div class="content api with-sidebar">
        
        <h1 class="page-title">File</h1>
        

        




<section>

<div>
    
        <h2>
            <span class="ancestors"><a href="fis.html">fis</a><a href="fis.file.html">.file</a>~</span>
        
        File
        </h2>
        
    
</div>

<article>
    <div class="container-overview">
    
        

    

    <a class="title-anchor" name="File"></a>
    <h4 class="name"><span class="type-signature"></span>new File<span class="signature">(props<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>File，fis 编译过程中，文件会被此类进行封装，对于文件的操作，都是通过此类来完成。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>path...</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>文件路径，可以作为多个参数输入，多个参数会被 <code>/</code> 串联起来。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>props</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>可以默认给文件添加一些属性</p></td>
        </tr>

    
    </tbody>
</table>






    <h5 class="subsection-title">Properties:</h5>

    

<table class="props">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>ext</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件名后缀。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>realpath</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件物理地址。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>realpathNoExt</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件物理地址，没有后缀。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>subpath</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件基于项目 root 的绝对路径。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>subpathNoExt</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件基于项目 root 的绝对路径，没有后缀。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>useCompile</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记是否需要编译。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>useDomain</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记是否使用带domain的地址。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>useCache</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>编译过程中是否采用缓存。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>useMap</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>编译后是否将资源信息写入 map.json 表。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>domain</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件的 domain 信息，在 useDomain 为 true 时会被作用在链接上。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>release</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件的发布路径，当值为  false 时，文件不会发布。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>url</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件访问路径。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件 id 属性，默认为文件在项目中的绝对路径，不建议修改。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>requires</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>用来记录文件依赖。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>asyncs</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>用来记录异步依赖。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>links</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>用来记录此文件用到了哪些文件。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>derived</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>用来存放派生的文件，比如 sourcemap 文件。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>extras</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>用来存放一些附属信息，注意：此属性将会添加到 map.json 里面。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isHtmlLike</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记此文件是否为 html 性质的文件。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isCssLike</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记此文件是否为 css 性质的文件。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isJsLike</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记此文件是否为 javascript 性质的文件。</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>isJsonLike</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>标记此文件是否为 json 性质的文件。</p></td>
        </tr>

    
    </tbody>
</table>




<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line142">line 142</a>
    </li></ul></dd>
    

    

    

    
</dl>
















    
    </div>

    

    

    

     

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <a class="title-anchor" name="addAsyncRequire"></a>
    <h4 class="name"><span class="type-signature"></span>addAsyncRequire<span class="signature">(id)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>添加异步依赖，同一个 ID 只会保留一条记录。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>依赖的文件标识(id)</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line516">line 516</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="addLink"></a>
    <h4 class="name"><span class="type-signature"></span>addLink<span class="signature">(filepath)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>向File.links中追加不重复link连接</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>filepath</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>连接</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line539">line 539</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="addRequire"></a>
    <h4 class="name"><span class="type-signature"></span>addRequire<span class="signature">(id)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>添加新的同步依赖，同一个 ID 只会保留一条记录。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>依赖的文件标识(id)</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line495">line 495</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="addSameNameRequire"></a>
    <h4 class="name"><span class="type-signature"></span>addSameNameRequire<span class="signature">(ext)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>处理同名但不同后缀名的require</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>ext</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>可以指定后缀，如果指定了，则添加指定后缀的同名依赖。</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line549">line 549</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="defineLikes"></a>
    <h4 class="name"><span class="type-signature"></span>defineLikes<span class="signature">()</span><span class="type-signature"> &rarr; {Undefined}</span></h4>

    



<div class="description">
    <p>定义默认的文件类型，如：isHtmlLike、isJsLike、isCssLike。他们是互斥的，当设置其中某个值为 true 时，
其他属性应该为 false.</p>
<p>提取到一个方法里面原因是：isXXXLike 的属性是通过 <code>Object.defineProperties</code>
定义的，当 file 对象从文件 cache 里面反序列回来后，isXxxLike 系列的属性都会丢失。 所以这块需要重新调用（定义）一次。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line303">line 303</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Undefined</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="exists"></a>
    <h4 class="name"><span class="type-signature"></span>exists<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    <p>返回文件是否真实存在。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line344">line 344</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getBase64"></a>
    <h4 class="name"><span class="type-signature"></span>getBase64<span class="signature">(prefix)</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>返回文件内容的base64编码</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>prefix</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>是否需要base64格式头, 默认为 <code>true</code>。</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line436">line 436</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getCacheData"></a>
    <h4 class="name"><span class="type-signature"></span>getCacheData<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>

    



<div class="description">
    <p>获取缓存数据, 文件每次编译都会存储一些属性到文件缓存。</p>
<p>默认除了 _xxxx 私有属性外所有的属性都会存入到缓存。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line623">line 623</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getContent"></a>
    <h4 class="name"><span class="type-signature"></span>getContent<span class="signature">()</span><span class="type-signature"> &rarr; {String|Buffer}</span></h4>

    



<div class="description">
    <p>获取文件内容</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line410">line 410</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>文件内容</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>
|

<span class="param-type">Buffer</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getHash"></a>
    <h4 class="name"><span class="type-signature"></span>getHash<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>获取文件内容的md5序列，多次调用，尽管文件内容有变化，也只会返回第一次调用时根据当时文件内容计算出来的结果。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line421">line 421</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>文件内容md5序列后的结果</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getHashRelease"></a>
    <h4 class="name"><span class="type-signature"></span>getHashRelease<span class="signature">(release)</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>获取文件的发布路径，会带上 hash 信息，如果设置了 useHash 的话。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>release</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>路径，不指定时使用此对象上的 release 属性。</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line478">line 478</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getId"></a>
    <h4 class="name"><span class="type-signature"></span>getId<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>返回文件 ID</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line450">line 450</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="getUrl"></a>
    <h4 class="name"><span class="type-signature"></span>getUrl<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>返回文件url, 跟直接获取 url 属性不同，此方法会受 useHash 和 useDomain 设置影响，会对应加上内容。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line458">line 458</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="isDir"></a>
    <h4 class="name"><span class="type-signature"></span>isDir<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    <p>判断文件路径是否为文件夹</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line392">line 392</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="isFile"></a>
    <h4 class="name"><span class="type-signature"></span>isFile<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    <p>判断文件路径是否为文件</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line384">line 384</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="isImage"></a>
    <h4 class="name"><span class="type-signature"></span>isImage<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    <p>返回文件是否为图片文件。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line360">line 360</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="isText"></a>
    <h4 class="name"><span class="type-signature"></span>isText<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    <p>返回文件是否为文本文件。</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line352">line 352</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="removeAsyncRequire"></a>
    <h4 class="name"><span class="type-signature"></span>removeAsyncRequire<span class="signature">(id)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>删除异步require路径</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件id</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line606">line 606</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="removeRequire"></a>
    <h4 class="name"><span class="type-signature"></span>removeRequire<span class="signature">(id)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>删除同步require路径</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>文件id</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line595">line 595</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="revertFromCacheData"></a>
    <h4 class="name"><span class="type-signature"></span>revertFromCacheData<span class="signature">(cached)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>当缓存有效时，将缓存数据还原到文件对象上。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>cached</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>缓存数据</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line646">line 646</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <a class="title-anchor" name="setContent"></a>
    <h4 class="name"><span class="type-signature"></span>setContent<span class="signature">(c)</span><span class="type-signature"> &rarr; {Object}</span></h4>

    



<div class="description">
    <p>设置文件内容，可以是字符串或者 Buffer 对象。</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>c</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            

            

            <td class="description last"><p>文件内容</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line401">line 401</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>返回自身，方便链式调用</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl>

    



        
            

    

    <a class="title-anchor" name="toString"></a>
    <h4 class="name"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>

    



<div class="description">
    <p>返回真实的物理路径</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="file.js.html">file.js</a>, <a href="file.js.html#line368">line 368</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>路径</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
    

    

    
</article>

</section>




    </div>
</div>

<footer>
  <div class="footer-inner">
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a> on Fri Jul 03 2015 16:22:12 GMT+0800 (CST) using the Minami theme.
    </div>
</footer>

<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
<!-- Latest compiled and minified JavaScript, requires jQuery 1.x (2.x not supported in IE8) -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/static/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript">
    (function(){
        var scrollBarEnabled = false;

        function isIE( version, comparison ){
            var $div = $('<div style="display:none;"/>').appendTo($('body'));
            $div.html('<!--[if '+(comparison||'')+' IE '+(version||'')+']><a>&nbsp;</a><![endif]-->');
            var ieTest = $div.find('a').length;
            $div.remove();
            return ieTest;
        }

        function updateScrollBar(){
            function enableScrollBar(){
                if (scrollBarEnabled)
                    return;
                scrollBarEnabled = true;
                $(".sidebar").perfectScrollbar({
                    wheelSpeed: 10,
                    wheelPropagation: false
                });
            }

            function disableScrollBar(){
                if (!scrollBarEnabled)
                    return;
                scrollBarEnabled = false;
                $(".sidebar").perfectScrollbar('destroy');
            }

            if ($(window).width()>760 && $(".sidebar").height() < $(".sidebar ul").height()){
                enableScrollBar();
            }else{
                disableScrollBar();
            }
        }

        //设置链接当前样式
        function setActive(){
            var href= window.location.href;
            $(".sidebar li a").each(function(){
                var link = $(this).attr("href");
                if(String(href).indexOf(link) > -1){
                    $(this).addClass("active");
                }
            })
        }

        //生成左边导航用于在移动端查看使用
        function buildSideNav(){
            $("nav .nav-left").clone().attr("class","main-nav").prependTo($(".sidebar"));

            $(".header-wrap .toggle").addClass("fa-list").on("click",function(){
                $(".sidebar").toggleClass("open");
                return false;
            })

            $("html").on("click",function(e){
                console.log(e.target);
                $(".sidebar").removeClass("open");
            })

            $(".sidebar").bind("click",function(e){
                e && e.stopPropagation();
            })
        }

        //hash平滑滚动，a链接添加active
        $('.sidebar li a').click(function(){
            $('.sidebar li a').removeClass("active");
            $(this).addClass("active");
            $(".sidebar").removeClass("open");
        });

        setActive();
        buildSideNav();


        if (!isIE(8, 'lte')){
            $(".sidebar").addClass('scrollbar');
            updateScrollBar();
            $(window).resize(updateScrollBar);
        }
    }());
</script>
</body>
</html>